package cn.wk.client;

import cn.wk.domain.CourseDoc;
import cn.wk.query.CourseDocQuery;
import cn.wk.util.AjaxResult;
import cn.wk.util.PageList;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class CourseDocFallbackFactory implements FallbackFactory<CourseDocClient> {
    @Override
    public CourseDocClient create(Throwable throwable) {
        return new CourseDocClient() {
            @Override
            public AjaxResult addOrUpdate(CourseDoc courseDoc) {
                return AjaxResult.me().setSuccess(false).setMessage("课程上架失败！");
            }

            @Override
            public AjaxResult del(Long courseId) {
                return AjaxResult.me().setSuccess(false).setMessage("课程下架失败！");
            }

            @Override
            public PageList<CourseDoc> queryCourse(CourseDocQuery courseDocQuery) {
                return new PageList<CourseDoc>();
            }
        };
    }
}
